/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package au.edu.unsw.bookmarket;

import au.edu.unsw.bookmarket.dao.BookDao;
import au.edu.unsw.bookmarket.dao.CourseDao;
import au.edu.unsw.bookmarket.dao.SellerDao;
import au.edu.unsw.bookmarket.dao.impl.BookDaoImpl;
import au.edu.unsw.bookmarket.dao.impl.CourseDaoImpl;
import au.edu.unsw.bookmarket.dao.impl.SellerDaoImpl;

/**
 *
 * @author gongz
 */
public class DataDeletion {

    public static void main(String[] args) {
        DataDeletion dataDeletion = new DataDeletion();
        if (dataDeletion.deleteAllBooks()) {
            BookDao bookDao = new BookDaoImpl();
            System.out.println("There're " + bookDao.getAllBooks().size() + " books in DB after deletion.");
        }
        if (dataDeletion.deleteAllCourses()) {
            CourseDao courseDao = new CourseDaoImpl();
            System.out.println("There're " + courseDao.getAllCourses().size() + " courses in DB after deletion.");
        }
        if (dataDeletion.deleteAllSellers()) {
            SellerDao sellerDao = new SellerDaoImpl();
            System.out.println("There're " + sellerDao.getAllSellers().size() + " sellers in DB after deletion.");
        }

    }

    public boolean deleteAllBooks() {
        BookDao bookDao = new BookDaoImpl();
        return bookDao.removeAllBooks();
    }

    public boolean deleteAllCourses() {
        CourseDao courseDao = new CourseDaoImpl();
        return courseDao.removeAllCourses();
    }

    public boolean deleteAllSellers() {
        SellerDao sellerDao = new SellerDaoImpl();
        return sellerDao.removeAllSellers();
    }
}
